<template>
  <el-dialog v-dialogDrag :visible.sync="dialogVisible" title="保养单详情" width="1050px" @close="closeBtn()">
    <button-group ref="buttonGroup" @cancel="dialogVisible = false" />
    <div class="formTopFont">保养任务单</div>
    <el-row>
      <div class="detailCont detailDialogFont twoDetailStyle">
        <h1>基础信息</h1>
        <ul>
          <li>
            <b>保养单号</b>
            <span>{{ objInfo.maintainNo }}</span>
          </li>
          <li>
            <b>设备</b>
            <span>{{ objInfo.equipName}}{{ objInfo.equipCode ? '【' + objInfo.equipCode + '】' : '' }}</span>
          </li>
          <li>
            <b>保养分类</b>
            <span>{{ objInfo.classifyName }}</span>
          </li>
          <li>
            <b>设备类型</b>
            <span>{{ objInfo.equipType }}</span>
          </li>
          <li>
            <b>状态</b>
            <span>{{ objInfo.status == 1 ? '新建' : objInfo.status == 2 ? '保养中':'已完成' }}</span>
          </li>
          <li>
            <b>保养人</b>
            <span>{{ objInfo.maintainByName }}</span>
          </li>
          <li>
            <b>开始时间</b>
            <span>{{ objInfo.startTime}}</span>
          </li>
          <li>
            <b>结束时间</b>
            <span>{{ objInfo.endTime }}</span>
          </li>
          <li>
            <b>保养工时</b>
            <span>{{ objInfo.maintainHours }}小时</span>
          </li>
          <li>
            <b>下达人</b>
            <span>{{ objInfo.releaseName }}</span>
          </li>
          <li>
            <b>下达时间</b>
            <span>{{ objInfo.releaseTime }}</span>
          </li>
        </ul>
      </div>
      <el-table ref="tableData" stripe border :data="objInfo.itemList" height="250px">
        <el-table-column prop="itemName" label="保养项名称" align="left" show-overflow-tooltip />
        <el-table-column prop="itemCode" label="保养项编码" align="left" show-overflow-tooltip />
        <el-table-column prop="remark" label="保养项描述" align="left" show-overflow-tooltip />
        <el-table-column prop="isFinish" label="是否完成" align="center" width="200">
          <template slot-scope="scope">
            <el-checkbox v-model="scope.row.isFinish" disabled :true-label="1" :false-label="0">是</el-checkbox>
          </template>
        </el-table-column>
      </el-table>
    </el-row>
  </el-dialog>
</template>
<script>
export default {
  props: {
    objInfo: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      dialogVisible: false,
      tableDate: []
    }
  },
  watch: {},
  mounted() {},
  methods: {
    showInfo() {
      this.$nextTick(async () => {
        // await this.getItemList()
        this.dialogVisible = true
      })
    },
    async getItemList() {
      console.log(this.objInfo)
      const res = await this.$axios.get(
        `/equip/maintain/infoRelation/getItemListByClassify?id=${this.objInfo.classifyId}`
      )
      if (res?.data.code === 200) {
        res.data.data.forEach((item) => (item.isFinish = '1'))
        this.tableDate = res.data.data
      }
    },
    closeBtn() {
      this.$emit('getTableInfo')
      this.dialogVisible = false
    }
  }
}
</script>
<style lang='scss' scoped>
</style>
